Monitor and Report the Disk Space  through SCRIPT using PowerShell  or VB
Dear All, We are having environment of more then 200 Production Servers which are Critical hence we need to Monitor and Report the Disk Space through SCRIPT using PowerShell or VB. If any body has already been done , Kindly share it. Thanks & Regards, Amit Satam
March 16th, 2012 3:08pm

Dear Gandalf, If I want to Test the above Script in one of the Machine , Do I need to simply execute the the PS Script or any alteration are required in it. Thanks & Regards, Amit Satam
Free Windows Admin Tool Kit Click here and download it now
March 16th, 2012 8:31pm

I'm getting these errors when running this .ps1 file Get-WmiObject : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Supply an argument that is not null or empty and then try the command again. At C:\test.ps1:27 char:77 + $data=Get-WmiObject -Class Win32_logicaldisk -filter "drivetype=3" -computer <<<< $computers + CategoryInfo : InvalidData: (:) [Get-WmiObject], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.GetWmiObjectCommand Out-File : Cannot bind argument to parameter 'FilePath' because it is null. At C:\test.ps1:75 char:56 + ConvertTo-Html -head $head -body $fragments | Out-File <<<< $Path + CategoryInfo : InvalidData: (:) [Out-File], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.OutFileComm and The term '.\drivereport.htm' is not recognized as the name of a cmdlet, function, script file, or operable program. Che ck the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:\test.ps1:77 char:18 + .\drivereport.htm <<<< + CategoryInfo : ObjectNotFound: (.\drivereport.htm:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
June 27th, 2012 9:24am

I'm getting these errors when running this .ps1 file Get-WmiObject : Cannot validate argument on parameter 'ComputerName'. The argument is null or empty. Supply an argument that is not null or empty and then try the command again. At C:\test.ps1:27 char:77 + $data=Get-WmiObject -Class Win32_logicaldisk -filter "drivetype=3" -computer <<<< $computers + CategoryInfo : InvalidData: (:) [Get-WmiObject], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.GetWmiObjectCommand Out-File : Cannot bind argument to parameter 'FilePath' because it is null. At C:\test.ps1:75 char:56 + ConvertTo-Html -head $head -body $fragments | Out-File <<<< $Path + CategoryInfo : InvalidData: (:) [Out-File], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.OutFileComm and The term '.\drivereport.htm' is not recognized as the name of a cmdlet, function, script file, or operable program. Che ck the spelling of the name, or if a path was included, verify that the path is correct and try again. At C:\test.ps1:77 char:18 + .\drivereport.htm <<<< + CategoryInfo : ObjectNotFound: (.\drivereport.htm:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException Try the following to export the results to Excel which will break the numbers up into several columns. Also, create a list of the server names in a text file and save it to C:\ as Servers.txt You may also have to set the execution policy if you have not done so. Open Powershell as Admin and type set-executionpolicy remotesigned Script taken from: http://community.spiceworks.com/scripts/show/1074-powershell-script-to-check-free-disk-spaces-for-servers $erroractionpreference = SilentlyContinue $a = New-Object -comobject Excel.Application $a.visible = $True $b = $a.Workbooks.Add() $c = $b.Worksheets.Item(1) $c.Cells.Item(1,1) = Machine Name $c.Cells.Item(1,2) = Drive $c.Cells.Item(1,3) = Total size (GB) $c.Cells.Item(1,4) = Free Space (GB) $c.Cells.Item(1,5) = Free Space (%) $c.cells.item(1,6) = "Name " $d = $c.UsedRange $d.Interior.ColorIndex = 19 $d.Font.ColorIndex = 11 $d.Font.Bold = $True $d.EntireColumn.AutoFit() $intRow = 2 $colComputers = get-content "C:\Servers.txt" foreach ($strComputer in $colComputers) { $colDisks = get-wmiobject Win32_LogicalDisk -computername $strComputer -Filter DriveType = 3" foreach ($objdisk in $colDisks) { $c.Cells.Item($intRow, 1) = $strComputer.ToUpper() $c.Cells.Item($intRow, 2) = $objDisk.DeviceID $c.Cells.Item($intRow, 3) = {0:N0} -f ($objDisk.Size/1GB) $c.Cells.Item($intRow, 4) = {0:N0} -f ($objDisk.FreeSpace/1GB) $c.Cells.Item($intRow, 5) = {0:P0} -f ([double]$objDisk.FreeSpace/[double]$objDisk.Size) $c.cells.item($introw, 6) = $objdisk.volumename $intRow = $intRow + 1 } } $d.EntireColumn.AutoFit() cls
Free Windows Admin Tool Kit Click here and download it now
September 7th, 2012 6:35pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics